home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / Container / Sources / Select.h < prev    next >
Encoding:
Text File  |  1996-12-16  |  5.2 KB  |  168 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Select.h
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SELECT_H
  11. #define SELECT_H
  12.  
  13. // ----- Part Layer -----
  14.  
  15. #ifndef FWSELECT_H
  16. #include "FWSelect.h"
  17. #endif
  18.  
  19. // ----- OS Layer -----
  20.  
  21. #ifndef FWRECT_H
  22. #include "FWRect.h"
  23. #endif
  24.  
  25. #ifndef FWRECSHP_H
  26. #include "FWRecShp.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class FW_CContent;
  34. class FW_CGraphicContext;
  35. class FW_CMouseEvent;
  36.  
  37. class CContainerPart;
  38. class CProxy;
  39. class CBaseContent;
  40. class CSelectionContent;
  41. class CContainerFrame;
  42.  
  43. //========================================================================================
  44. //    class CContainerSelection
  45. //========================================================================================
  46.  
  47. class CContainerSelection : public FW_CSelection
  48. {
  49. //----------------------------------------------------------------------------------------
  50. //    Initialization/Destruction
  51. //
  52.   public:
  53.     FW_DECLARE_AUTO(CContainerSelection)
  54.  
  55.     CContainerSelection(Environment* ev, CContainerPart* part);
  56.     virtual         ~CContainerSelection();
  57.     
  58. //----------------------------------------------------------------------------------------
  59. //    Inherited API
  60. //
  61.   public:
  62.     virtual void        CloseSelection(Environment* ev);
  63.     virtual void        SelectAll(Environment* ev);
  64.     virtual FW_Boolean    IsEmpty(Environment* ev) const;
  65.     virtual void        ClearSelection(Environment* ev);
  66.     void                 AddSiblingFrame (Environment *ev); // sibling frames
  67.     
  68.     virtual FW_CContent* GetSelectedContent(Environment* ev);
  69.     
  70.     virtual ODShape*    AcquireSelectionShape(Environment* ev, ODFacet* facet, FW_CFrame* frame);
  71.     virtual ODShape*    AcquireSelectionOutline(Environment* ev, ODFacet* facet, FW_CFrame* frame);
  72.     
  73.     virtual FW_Boolean    IsMouseInDraggableItem(Environment* ev, 
  74.                             FW_CFrame* frame,
  75.                             const FW_CMouseEvent& theMouseEvent, 
  76.                             FW_Boolean inBackground);
  77.  
  78.     virtual void        UpdateSelectionOnMouseDown(Environment* ev, 
  79.                             const FW_CMouseEvent& mouseEvent,
  80.                             ODFacet* embeddedFacet,
  81.                             FW_Boolean inEmbeddedFrameBorder,
  82.                             FW_Boolean inBackground);
  83.     
  84. //----------------------------------------------------------------------------------------
  85. //    New API
  86. //
  87.   public:
  88.     CProxy*         WhichHandle(Environment* ev, 
  89.                             FW_CGraphicContext& gc, 
  90.                             const FW_CPoint& mouse, 
  91.                             short& whichHandle,
  92.                             FW_Fixed zoomFactor) const;
  93.     
  94.     void            RenderSelectionHandles(Environment* ev, FW_CGraphicContext& gc, FW_Fixed zoomFactor);
  95.     void            RenderHandles(Environment* ev, CProxy* proxy);
  96.     void            RenderAllHandles(Environment* ev, CContainerFrame* frame);
  97.     
  98.     void            InvalidateSelectionHandles(Environment* ev, CContainerFrame* frame);
  99.  
  100.     void            AddToSelection(Environment* ev, CProxy* theProxy, FW_Boolean renderHandles);
  101.     void            RemoveFromSelection(Environment* ev, CProxy* theProxy, FW_Boolean renderHandles);
  102.  
  103.     void            OffsetSelection(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta);
  104.  
  105.     FW_Boolean        Resize(Environment* ev, const FW_CMouseEvent& theMouseEvent);    
  106.  
  107.     void            SelectWithRectangle(Environment* ev, const FW_CMouseEvent& theMouseEvent);
  108.  
  109.     FW_CPoint        CenterSelection(Environment* ev, FW_CFrame* scopeFrame);
  110.     
  111.     ODShape*        GetUpdateShape(Environment *ev) const;
  112.     FW_CRect        GetDragRect(Environment *ev) const;
  113.  
  114.     CProxy*            GetAnchorProxy() const;
  115.  
  116.     void            ClearCache(Environment *ev);
  117.     void            CalcCache(Environment* ev);
  118.  
  119.     unsigned long    Count() const;
  120.     
  121.     CProxy*            GetFirstSelectedProxy() const;
  122.     
  123.   private:
  124.     void            DoAdd(Environment* ev, CProxy* proxy);
  125.     void            DoRemove(Environment* ev, CProxy* proxy);
  126.     FW_Boolean        IsSelectedShapesChanged(Environment* ev) const;
  127.         
  128.   public:
  129.     void            ProxyAdded(Environment* ev, CProxy* proxy);
  130.     void            SelectContent(Environment* ev, CBaseContent* content);
  131.     CBaseContent*    GetSelectionContent(Environment* ev);
  132.  
  133.     void            DeleteSelection(Environment* ev);
  134.     FW_Boolean        IsOKtoEdit(Environment* ev);
  135.  
  136.     virtual FW_Boolean  CanPasteAsLink(Environment* ev,  ODPasteAsMergeSetting& setting,  ODStorageUnit* su); //Override
  137.  
  138.  
  139. //----------------------------------------------------------------------------------------
  140. //    Data Members
  141. //
  142.   private:
  143.     CContainerPart*        fContainerPart;
  144.     FW_CRect            fDragRect;
  145.     ODShape*            fUpdateShape;
  146.     unsigned long        fCount;
  147.     CProxy*                fAnchorProxy;
  148.     short                fClickedHandle;
  149.     
  150.     CSelectionContent*    fSelectionContent;
  151.     
  152.     FW_CRectShape        fWorkingHandle;
  153.     CSelectionContent*    fDraggedContent;
  154. };
  155.  
  156. //========================================================================================
  157. //    CContainerSelection Inlines
  158. //========================================================================================
  159.  
  160. //----------------------------------------------------------------------------------------
  161. //    CContainerSelection::GetAnchorProxy
  162. //----------------------------------------------------------------------------------------
  163. inline CProxy* CContainerSelection::GetAnchorProxy() const
  164. {
  165.     return fAnchorProxy;
  166. }
  167.  
  168. #endif